/***************************************************************************
 *   Copyright (c) 2015 Stefan Tröger <stefantroeger@gmx.net>              *
 *   Copyright (c) 2015 Alexander Golubev (Fat-Zer) <fatzer2@gmail.com>    *
 *                                                                         *
 *   This file is part of the FreeCAD CAx development system.              *
 *                                                                         *
 *   This library is free software; you can redistribute it and/or         *
 *   modify it under the terms of the GNU Library General Public           *
 *   License as published by the Free Software Foundation; either          *
 *   version 2 of the License, or (at your option) any later version.      *
 *                                                                         *
 *   This library  is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU Library General Public License for more details.                  *
 *                                                                         *
 *   You should have received a copy of the GNU Library General Public     *
 *   License along with this library; see the file COPYING.LIB. If not,    *
 *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
 *   Suite 330, Boston, MA  02111-1307, USA                                *
 *                                                                         *
 ***************************************************************************/

#include "pch.h"

#include <App/Document.h>
#include "Base/Console.h"
#include "Base/Vector3D.h"

#include "ViewProviderOrigin.h"
#include "Gui/Application.h"
#include "Gui/Command.h"
#include <App/Document.h>
#include "ViewProviderLine.h"
#include "ViewProviderPlane.h"


using namespace Gui;


TYPESYSTEM_SOURCE(Gui::ViewProviderOrigin, Gui::ViewProviderDocumentObject)

/**
 * Creates the view provider for an object group.
 */
ViewProviderOrigin::ViewProviderOrigin()
{
 

    sPixmap = "Std_CoordinateSystem";
    Visibility .setValue (false);

    pcGroupChildren = new SoGroup();
    pcGroupChildren->ref();
}

ViewProviderOrigin::~ViewProviderOrigin() {
    pcGroupChildren->unref();
    pcGroupChildren = nullptr;
}

std::vector<App::DocumentObject*> ViewProviderOrigin::claimChildren() const {
    return std::vector<App::DocumentObject*>();
}

std::vector<App::DocumentObject*> ViewProviderOrigin::claimChildren3D() const {
    return claimChildren ();
}

void ViewProviderOrigin::attach(App::DocumentObject* pcObject)
{
    Gui::ViewProviderDocumentObject::attach(pcObject);
    addDisplayMaskMode(pcGroupChildren, "Base");
}

std::vector<std::string> ViewProviderOrigin::getDisplayModes() const
{
    return { "Base" };
}

void ViewProviderOrigin::setDisplayMode(const char* ModeName)
{
    if (strcmp(ModeName, "Base") == 0)
        setDisplayMaskMode("Base");
    ViewProviderDocumentObject::setDisplayMode(ModeName);
}

void ViewProviderOrigin::setTemporaryVisibility(bool axis, bool plane) {
    
}

void ViewProviderOrigin::resetTemporaryVisibility() {
    for(std::pair<Gui::ViewProvider*, bool> pair : tempVisMap) {
        pair.first->setVisible(pair.second);
    }
    tempVisMap.clear ();
}

double ViewProviderOrigin::defaultSize()
{
    
    return 0.25 * (100.0);
}

bool ViewProviderOrigin::isTemporaryVisibility() {
    return !tempVisMap.empty();
}



bool ViewProviderOrigin::onDelete(const std::vector<std::string> &) {
    
    return true;
}
